package com.gopay.common.event;

import java.util.Map;

import com.gopay.common.domain.report.Event;
import com.gopay.common.event.handler.EventHandlerGroup;

/**
 * 
 * @EventBus.java
 * @author zhaoxubing
 * @2015年5月22日 上午11:46:15  www.gopay.com.cn Inc.All rights reserved.
 */
public class EventBus{
    public final static String prefix = "E_";
    
    private Map<String, Object> getHandlerGroup;
	public void publish(Event event) throws Exception {
	    
	    String type = prefix + event.getType();
	    EventHandlerGroup handlerGroup= (EventHandlerGroup) getHandlerGroup.get(type);
	   
	    handlerGroup.handler(event);
	   
	}
	
	public void setGetHandlerGroup(Map getHandlerGroup) {
        this.getHandlerGroup = getHandlerGroup;
    }

}
